package com.ruoyi.project.publicity.controller;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.surveys.domain.SurveysQuestion;
import com.ruoyi.project.surveys.service.ISurveysQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 题目信息Controller
 * 
 * @author zhimin-hu
 * @date 2020-05-02
 */
@RestController
@RequestMapping("/publicity/surveys")
public class SurveysController extends BaseController
{
    @Autowired
    private ISurveysQuestionService surveysQuestionService;

    /**
     * 查询题目信息列表
     */
    //@PreAuthorize("@ss.hasPermi('publicity:surveys')")
    @GetMapping("/list")
    public TableDataInfo list(SurveysQuestion surveysQuestion)
    {
        startPage();
        List<SurveysQuestion> list = surveysQuestionService.selectSurveysQuestionList(surveysQuestion);
        return getDataTable(list);
    }



    /**
     * 获取题目信息详细信息
     */
    //@PreAuthorize("@ss.hasPermi('publicity:surveys')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(surveysQuestionService.selectSurveysQuestionById(id));
    }
}
